package com.linux.huhx.thread3.queueLength_1;

/**
 * @Author: huhx
 * @Date: 2017-10-31 上午 8:50
 */
public class Run {
    public static void main(String[] args) throws InterruptedException {
        final Service service = new Service();

        Runnable runnable = () -> {
            service.serviceMethod1();
        };

        Thread[] threads = new Thread[10];
        for (int i = 0; i < 10; i++) {
            threads[i] = new Thread(runnable);
        }
        for (int i = 0; i < 10; i++) {
            threads[i].start();
        }
        Thread.sleep(2000);
        System.out.println("There have " + service.getLock().getQueueLength() + "等待锁.");
    }
}
